from django.urls import path, re_path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from user import views
from user.views import SelfUserInfo, UserGroupManage, is_me_admin

urlpatterns = [
    path('register/', views.user_register),
    path('login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('login/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('myinfo/', SelfUserInfo.as_view()),
    path('is_self_admin/', is_me_admin),
    re_path(r'^ugm/(?:(?P<group_id>\d+)/)?$', views.UserGroupManage.as_view()),
    re_path(r'^ugm/detail/(?:(?P<group_id>\d+)/)?$', views.get_group_detail),
    re_path(r'^em/(?:(?P<exercise_id>\d+)/)?$', views.UserQuestionManage.as_view()),
    re_path(r'^egm/$', views.UserQuestionGroupManage.as_view())
]
